package com.atguigu.tingshu.user.api;

import com.atguigu.tingshu.common.cache.GuiGuCache;
import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.model.user.VipServiceConfig;
import com.atguigu.tingshu.user.service.VipServiceConfigService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name = "VIP服务配置管理接口")
@RestController
@RequestMapping("api/user")
@SuppressWarnings({"all"})
public class VipServiceConfigApiController {

    @Autowired
    private VipServiceConfigService vipServiceConfigService;


    /**
     * 查询所有VIP服务配置
     *user:vipconfig
     * @return
     */
    @Operation(summary = "查询所有VIP服务配置")
    @GetMapping("/vipServiceConfig/findAll")
	@GuiGuCache(prefix = "user:vipconfig:list")
    public Result<List<VipServiceConfig>> findAll() {
        return Result.ok(vipServiceConfigService.list());
    }

	/**
	 * 查询指定VIP服务配置
	 * @param id
	 * @return
	 */
    @Operation(summary = "查询指定VIP服务配置")
	@GuiGuCache(prefix = "user:vipconfig:")
    @GetMapping("/vipServiceConfig/getVipServiceConfig/{id}")
    public Result<VipServiceConfig> getVipServiceConfig(@PathVariable Long id) {
        return Result.ok(vipServiceConfigService.getById(id));
    }
}

